<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/24 0024
 * Time: 00:33
 */
$db = new SQLite3("./crm.db", 0666) or die('fail');
//unset($db);
$query = "
    CREATE TABLE document(
      id INTEGER PRIMARY KEY,
      title,
      intro,
      body
    );
    CREATE TABLE dictionary ( 
      id INTEGER PRIMARY KEY, 
      word
    );
    CREATE TABLE lookup (
      document_id INTEGER, 
      word_id INTEGER, 
      position INTEGER
    );
    CREATE UNIQUE INDEX word ON dictionary(word);
";
//INTEGER 用来储存数字
$db->query($query) or die(sqlite_error_string(sqlite_last_error($db)));